import hashlib

def create_hash(str,SALE):
    md_sale = hashlib.md5((str + SALE).encode())  # MD5加盐加密方法一：将盐拼接在原密码后
    md5salepwd = md_sale.hexdigest()
    return md5salepwd


if __name__ == "__main__":
    text1 = '123456'
    text2 = '123456'
    SALE = text1[:4]  # 设置盐值
    print(text1)
    print(str(text1) + SALE)

    print(create_hash(text1, SALE))
    print(create_hash(text2, SALE))